package cn.cas.mango.controller;

import cn.cas.mango.dto.Message;
import cn.cas.mango.dto.param.BaseTimeParam;
import cn.cas.mango.dto.param.HotSpotNewsParam;
import cn.cas.mango.dto.param.IdsParam;
import cn.cas.mango.service.HotListDetailSearchService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/Hotspots/")
@ResponseBody
@CrossOrigin
@Api(value="地方热点", tags="热点排序")
public class InternetSearch {
  @Autowired
  private HotListDetailSearchService searchService;

  @GetMapping
  public Message index() {
    return Message.builder().msg("").build();
  }

  @RequestMapping(value = "getAssembleHot", method = {RequestMethod.GET})
  public Message searchAdvanced(HotSpotNewsParam queryParam) {
    return searchService.cluster_vector(queryParam);
  }

  @RequestMapping(value = "getAssembleHot", method = {RequestMethod.POST})
  public Message searchAdvancedPost2(@RequestBody HotSpotNewsParam queryParam)  {
    return searchService.cluster_vector(queryParam);
  }

  @RequestMapping(value = "getIds", method = {RequestMethod.GET})
  public Message getIds(IdsParam queryParam) {
    return searchService.getIds(queryParam);
  }

  @RequestMapping(value = "getIds", method = {RequestMethod.POST})
  public Message getIdsPost(@RequestBody IdsParam queryParam)  {
    return searchService.getIds(queryParam);
  }

  @RequestMapping(value = "getGroupsByArea", method = {RequestMethod.GET})
  public Message getGroupsByArea(BaseTimeParam queryParam) {
    return searchService.getGroupsByArea(queryParam);
  }

  @RequestMapping(value = "getGroupsByArea", method = {RequestMethod.POST})
  public Message getGroupsByAreaPost(@RequestBody BaseTimeParam queryParam)  {
    return searchService.getGroupsByArea(queryParam);
  }


  @RequestMapping(value = "getGroupsByType", method = {RequestMethod.GET})
  public Message getGroupsByType(BaseTimeParam queryParam) {
    return searchService.getGroupsByType(queryParam);
  }

  @RequestMapping(value = "getGroupsByType", method = {RequestMethod.POST})
  public Message getGroupsByTypePost(@RequestBody BaseTimeParam queryParam)  {
    return searchService.getGroupsByType(queryParam);
  }





}
